package com.bestcem.xm.componet.tinyurl.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName(value = "ds_tinyurl_mapping")
public class TinyurlMapping {
    @TableId(value = "id")
    private String id;

    /**
     * 短链keyid
     */
    @TableField(value = "short_url_keyid")
    private String shortUrlKeyid;

    /**
     * 短链keyid的long类型
     */
    @TableField(value = "short_url_keyid_long")
    private Long shortUrlKeyidLong;

    /**
     * 原始地址
     */
    @TableField(value = "original_url")
    private String originalUrl;

    /**
     * 原始地址hashcode
     */
    @TableField(value = "original_url_hashcode")
    private String originalUrlHashcode;

    @TableField(value = "created_id")
    @JsonProperty("created_id")
    private String createdId;

    @TableField(value = "updated_id")
    @JsonProperty("updated_id")
    private String updatedId;

    @TableField(value = "version_id", fill = FieldFill.INSERT)
    @Version
    @JsonProperty("version_id")
    private Integer versionId;

    @TableField(value = "deleted", fill = FieldFill.INSERT)
    //@TableLogic
    @JsonProperty("deleted")
    private Boolean deleted;

    /**
     * 创建时间
     */
    @TableField(value = "created_dt", fill = FieldFill.INSERT)
    @JsonProperty("created_dt")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdDt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_dt", fill = FieldFill.INSERT_UPDATE)
    @JsonProperty("updated_dt")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updatedDt;
}